package com.ydgk.dao;

import com.ydgk.bean.FurnitureKinds;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface FurnitureKindsMapper {
    @Insert("insert into furniturekinds values(#{fkid},#{fkname},#{fkprice},#{cost},#{stock},#{fkface},#{sales},#{f_fid})")
    int insert(FurnitureKinds furnitureKinds);

    @Delete("delete from furniturekinds where f_fid = #{fid}")
    void deleteByFid(int fid);

    @Select("select * from furniturekinds where f_fid = #{fid}")
    List<FurnitureKinds> findByFid(int fid);

    @Select("select * from furniturekinds where fkid = #{fkid}")
    FurnitureKinds findById(int fkid);

    @Update("update furniturekinds set fkname = #{fkname} , fkprice = #{fkprice} , cost = #{cost} , stock = #{stock} , sales = #{sales}, fkface = #{fkface} where fkid = #{fkid}")
    int updateById(FurnitureKinds furnitureKinds);

    @Delete("delete from furniturekinds where fkid = #{fkid}")
    int deleteByFkid(int fkid);

    @Select("select * from furniturekinds fk, furniture f, kindstype kt where fk.f_fid = f.fid and f.kt_ktid = kt.ktid and kt.k_kid = #{kid}")
    List<FurnitureKinds> findByKid(Integer kid);
}
